      <?php
        include("seguridad.php");
        include("top.php");
	include("left.php"); ?>
	<div id="contentC">
	  <div class="center">
	    <h1>Aqui va el contenido</h1><br />
	  </div>
<?php
    include_once("fachadaBD.php");
    $f = new fachadaBD();
    //$options = $f->obtenerProcesadores();
    $marcas = $f->obtenerMarcas();
  //$amd = $f->obtenerAmd();
  //$intel = $f->obtenerIntel();
    if ($_GET["marca"] != ""){
      $tecno = $f->getTecnologiaByMarca($_GET["marca"]);
      $stecno = "";
      while ($row = mysql_fetch_assoc($tecno)){
        if ($_GET["tecno"] == $row["NOMBRE"]){
          $stecno .= "<option selected value=\"".$row["NOMBRE"]."\">".$row["NOMBRE"]."</option> ";
        }else{
          $stecno .= "<option value=\"".$row["NOMBRE"]."\">".$row["NOMBRE"]."</option> ";
        }
      }
    }
    if ($_GET["tecno"] != ""){
      $modelo = $f->getModeloByTecno($_GET["tecno"]);
      $smodelo = "";
      while ($row = mysql_fetch_assoc($modelo)){
        $smodelo .= "<option value=\"".$row["NOMBRE"]."\">".$row["NOMBRE"]."</option> ";
      }
    }
    $f->cerrar();
?>
<form name = "registro" action="insertProducto.php" method="POST" enctype="multipart/form-data">
	 
	<center><table border=0>
        <tr><td>Tipo de Laptop</td><td><select size="1" name="tipo">
				<option selected value=""> </option>
				<option  value="1">Laptop</option>
				<option  value="2">Minilaptop</option>
				</select></td></tr>
	<tr><td>Modelo</td><td><input type="text" name="modelo" size="20" value=""></td></tr>
        <tr><td>Marca</td><td><SELECT name="marca" >
                                    <OPTION VALUE=0>
                                    <?=$marcas?>
                                    </SELECT> <a href="registroMarcas.php">+</a> </td></tr>
        <tr><td>C&oacute;digo</td><td><input type="text" name="codigo" size="20" value=""></td></tr>
        <tr><td>Precio</td><td><input type="text" name="precio" size="20" value=""></td></tr>
	<tr><td>Imagen Principal</td><td><input  type="file" name="imagenp"  value=""></td></tr>
	<tr><td>Imagen Peque</td><td><input type="file" name="imagenpeq" size="20" value=""></td></tr>
	<tr><td>Imagen Flash</td><td><input  type="file" name="flash" size="20" value=""></td></tr>
	<tr><td>Imagen Propaganda</td><td><input  type="file" name="propaganda" size="20" value=""></td></tr>
  <tr>
    <td>Marca Procesador</td>
    <td><select id="marcaP" name="marcaP" onchange="fmarca()">
        <option value="0">
        <option <?php
                  if ($_GET["marca"] == "AMD")
                    echo "selected ";
                ?>value="AMD">AMD
        <option <?php
                  if ($_GET["marca"] == "INTEL")
                    echo "selected ";
                ?>value="INTEL">INTEL
      </select>
    </td>
  </tr>
  <tr>
    <td>Tecnologia Procesador</td>
    <td>
      <select name="tecnologia" onchange="ftecno()">
        <option selected value="0">
          <?php
            if ($_GET["marca"] != ""){
              echo $stecno;
            }
          ?>
      </select>
      <a href="registroTecnologia.php">+</a>
    </td>
  </tr>
  <tr>
    <td>Modelo Procesador</td>
    <td>
      <select name="procesador">
        <option selected value="0">
          <?php
      if ($_GET["tecno"] != ""){
        echo $smodelo;
      }
          ?>
      </select>
      <a href="registroProcesadores.php">+</a>
    </td>
  </tr>
  <!--
	<tr>
    <td>Procesador</td>
    <td><SELECT name="procesador">
          <OPTION VALUE=0>
          <?=$options?>
        </SELECT>
        <a href="registroProcesadores.php">+</a>
    </td>
  </tr>
  -->
        <tr><td>Velocidad procesador</td><td><input type="text" name="velproc" size="20" value=""> GHZ</td></tr>
        <tr><td>Tipo de Memoria</td><td><select size="1" name="tipomem">
				<option selected value=""> </option>
				<option  value="DDR">DDR</option>
				<option  value="DDR2">DDR2</option>
				<option  value="DDR3">DDR3</option>
				</select></td></tr>
	<tr><td>Memoria</td><td><select size="1" name="memoria">
				<option selected value=""> </option>
				<option  value=1>1</option>
				<option  value=2>2</option>
				<option  value=3>3</option>
     				<option  value=4>4</option>
				<option  value=5>5</option>
                		<option  value=6>6</option>
				<option  value=7>7</option>
				<option  value=8>8</option>
				</select> GB</td></tr>
	<tr><td>Disco</td><td><select size="1" name="disco">
				<option selected value=""> </option>
				<option  value=40>40</option>
				<option  value=80>80</option>
				<option  value=100>100</option>
     				<option  value=120>120</option>
				<option  value=160>160</option>
                		<option  value=200>200</option>
				<option  value=250>250</option>
				<option  value=320>320</option>
                                <option  value=500>500</option>
                                <option  value=640>640</option>
				</select> GB</td></tr>
	<tr><td>Velocidad de Disco</td><td><select size="1" name="velodisc">
				<option selected value=""> </option>
				<option selected value=5400>5400</option>
				<option selected value=7200>7200</option>
				</select> RPM</td></tr>
        <tr><td>Idioma de Teclado</td><td><input type="radio" name="teclado" value="Ingles"> Ingl&eacute;s
                <input type="radio" name="teclado" value="Espanol" checked> Espa&ntilde;ol</td></tr>
        	<tr><td>Pantalla </td><td><select size="1" name="pantalla">
				<option selected value=""> </option>
				<option  value=8.9>8.9</option>
				<option  value=10.1>10</option>
				<option  value=10.1>10.1</option>
				<option  value=10.1>10.2</option>
     				<option  value=12>12</option>
     				<option  value=12.1>12.1</option>
				<option  value=13.3>13.3</option>
                                <option  value=14>14</option>
     				<option  value=14.1>14.1</option>
				<option  value=15.4>15.4</option>
                		<option  value=15.6>15.6</option>
				<option  value=17>17</option>
                                </select> pulgadas</td></tr>
                <tr><td>Descripci&oacute;n pantalla</td><td><input type="text" name="pcoment" size="20" value=""></td></tr>
                <tr><td>Sistema Operativo</td><td><select size="1" name="sistema">
				<option selected value=""> </option>
                                <option  value="Windows XP">Windows XP</option>
				<option  value="Windows Vista">Windows Vista</option>
				<option  value="Windows 7 Starter">Windows 7 Starter</option>
				<option  value="Windows 7 Home Premium">Windows 7 Home Premium</option>
     				<option  value="Windows 7 Profesional">Windows 7 Profesional</option>
				<option  value="Windows 7 Ultimate">Windows 7 Ultimate</option>
                                <option  value="Windows 7 Home Basic">Windows 7 Home Basic</option>
                                <option  value="Linux">Linux</option>
                                </select></td></tr>
               <tr><td>Tarjeta de Video</td><td><input type="radio" name="tarjeta" value="dedicado"> Dedicado
                <input type="radio" name="tarjeta" value="compartido" checked> Compartido</td></tr>
               	<tr><td>Memoria de Video</td><td><input type="text" name="memvideo" size="20" value=""></td></tr>
        <tr><td>Puertos USB</td><td><input type="text" name="puertos" size="20" value=""></td></tr>
        <tr><td>Webcam</td><td><input type="checkbox" name="webcam" value="1"></td></tr>
        <tr><td>Resoluci&oacute;n de la Webcam</td><td><input type="text" name="camres" size="20" value=""></td></tr>
        <tr><td>Unidad de lectura</td><td><select size="1" name="unidad">
				<option selected value=""> </option>
				<option  value="CD/DVD-RW">CD/DVD-RW</option>
				<option  value="CD/DVD-RW CON LIGHTSCRIBE">CD/DVD-RW con lightscribe</option>
				</select></td></tr>
	<tr><td>Tipo de garantia</td><td><select size="1" name="garantia">
				<option selected value=""> </option>
				<option  value="1 ano de garantia">1 a&ntilde;o de garant&iacute;a</option>
				</select></td></tr>
      	<tr><td>Tipo de entrega</td><td><select size="1" name="entrega">
				<option selected value=""> </option>
				<option  value="Retiro personal el mismo dia - Env&iacute;o nacional mismo dia">
          Retiro personal el mismo dia - Env&iacute;o nacional mismo dia</option>
        <option  value="Retiro personal al dia siguiente- Env&iacute;o nacional al d&iacute;a siguiente">
          Retiro personal al dia siguiente- Env&iacute;o nacional al d&iacute;a siguiente</option>
				</select></td></tr>
       	<tr><td>Formas de pago</td><td><select size="1" name="pago">
				<option selected value=""> </option>
				<option  value="deposito">Deposito Bancario</option>
      				<option  value="transferencia">Transferencia</option>
				<option  value="tarjeta">Tarjeta de Cr&eacute;dito</option>
                                </select></td></tr>
        <tr><td>Wifi</td><td><input type="checkbox" name="wifi" value="1"></td></tr>
        <tr><td>Bluetooth</td><td><input type="checkbox" name="bluetooth" value="1"></td></tr>
        <tr><td>Bateria</td><td><select size="1" name="bateria">
				<option selected value=""> </option>
				<option  value=3>3 celdas</option>
				<option  value=4>4 celdas</option>
                                <option  value=6>6 celdas</option>
                                <option  value=8>8 celdas</option>
				<option  value=9>9 celdas</option>
     				</select> </td></tr>
        <tr><td>Puertos</td><td><table><tr><td>VGA <input type="checkbox" name="vga" value="1"></td>
                                        <td>NTSC/PAL <input type="checkbox" name="tv" value="1"></td>
                                        <td>Microfono <input type="checkbox" name="microfono" value="1"></td></tr>
                                        <tr>
                                        <td>Ethernet <input type="checkbox" name="rj45" value="1"></td>
                                        <td>Modem <input type="checkbox" name="rj11" value="1"></td>
                                        <td>HDMI <input type="checkbox" name="hdmi" value="1"></td></tr>
                                        
                                        </tr>
                                </table>
            </td></tr>
       	<tr><td>Otros</td><td><input type="text" name="otros" size="20" value=""></td></tr>
        <tr><td>Disponibildad</td><td><input type="checkbox" name="disp" value="1"></td></tr>
        <tr class=b><td width=90>Descripcion</td> <td><textarea name="descripcion" cols='20' rows='5' onKeyUp="return maximaLongitud(this,249)"></textarea></td></tr>

        </table></center>	<center><input type="button" value="enviar" name="enviar" onClick="javascript:comprueba();"></center>
</form>

<script language="JavaScript" type="text/javascript">

function fmarca(){
  if (document.registro.marcaP.value != 0){
    var str = "ProductRegister.php?marca="+document.registro.marcaP.value;
    location.href= str;
  }
  /*
  if (document.getElementById('marca').value == 1){
    document.getElementById('iTecnologia').setAttribute('style','visibility: hidden');
    document.getElementById('aTecnologia').setAttribute('style','visibility: visible');
    alert(document.getElementById('marca').value);
  }else if(document.getElementById('marca').value == 2){
    document.getElementById('aTecnologia').setAttribute('style','visibility: hidden');
    document.getElementById('iTecnologia').setAttribute('style','visibility: visible');
    alert(document.getElementById('marca').value);
  }
  */
}

function ftecno(){
  if (document.registro.tecnologia.value != 0){
    if (document.registro.marcaP.value ==0){
      var str = "ProductRegister.php?tecno="+document.registro.tecnologia.value;
    }else{
      var str = "ProductRegister.php?marca="+document.registro.marcaP.value+"&tecno="+
      document.registro.tecnologia.value;
    }
    location.href= str;
  }
}


function comprueba(){

	if (document.forms.registro.modelo.value==""){
		alert("Debe indicar el nombre de modelo");
	}else{
            if (document.forms.registro.marca.value==""){
		alert("Debe indicar el nombre de la marca");
            }else{
                if (document.forms.registro.codigo.value==""){
                    alert("Debe indicar el c&oacute;digo de producto");
                }else{
                    document.registro.submit();
                }
            }
	}
}


</script>
</div>
<?php include("rightbottom.php");?>	
